#include<iostream>
using namespace std;
const int N = 1e5 + 10;
typedef long long LL;
int arr[N];
int n, m;
int main()
{
	cin >> n >> m;
	int ans = 0;
	for (int i = 1; i <= n; i++)cin >> arr[i];
	LL temp = 0;
	for (int i = 1; i <= n; i++) {
		if (temp + arr[i] <= m)temp += arr[i];
		else {
			ans++;
			temp = arr[i];
		}
	}
	if (temp)ans++;
	cout << ans << endl;
	return 0;
}